#include "test_ctrl.h"
#include "key.h"
#include "relay_ctrl.h"
#include "led.h"


typedef enum
{
	CTRL_INIT,
	CTRL_ACT,
}TEST_CTRL_STATE;

static TEST_CTRL_STATE		test_state;




void test_ctrl_init(void)
{
	test_state = CTRL_INIT;
}

void test_ctrl_task(void)
{
	switch(test_state){
		case CTRL_INIT:
			set_key_switch(KEY_ENABLE);
//			set_relay_sw(RELAY_OFF);
			test_state = CTRL_ACT;
			break;
		case CTRL_ACT:
			if(is_key_click()){
				if(get_relay_sw() == RELAY_OFF){
					set_relay_sw(RELAY_ON);
					set_led(ON);
				}else{
					set_relay_sw(RELAY_OFF);
					set_led(OFF);
				}
			}
			break;
	
	}
	

}